<HTML>
<BODY>
<PRE>
<!-- Manpage converted by man2html 3.0.1 -->

<B><A HREF="STRDUP.html">STRDUP(3)</A></B>	       FreeBSD Library Functions Manual 	     <B><A HREF="STRDUP.html">STRDUP(3)</A></B>


</PRE>
<H2>NAME</H2><PRE>
     <B>strdup</B> - save a copy of a string


</PRE>
<H2>SYNOPSIS</H2><PRE>
     <B>#include</B> <B>&lt;string.h&gt;</B>

     <I>char</I> <I>*</I>
     <B>strdup</B>(<I>const</I> <I>char</I> <I>*str</I>)


</PRE>
<H2>DESCRIPTION</H2><PRE>
     The <B>strdup</B>() function allocates sufficient memory for a copy of the
     string <I>str</I>, does the copy, and returns a pointer to it.  The pointer may
     subsequently be used as an argument to the function <B><A HREF="malloc.html">free(3)</A></B>.

     If insufficient memory is available, NULL is returned.


</PRE>
<H2>SEE ALSO</H2><PRE>
     <B><A HREF="malloc.html">free(3)</A></B>,  <B><A HREF="malloc.html">malloc(3)</A></B>


</PRE>
<H2>HISTORY</H2><PRE>
     The <B>strdup</B>() function first appeared in 4.4BSD.

BSD				 June 9, 1993				     1
</PRE>
<HR>
<ADDRESS>
Man(1) output converted with
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
</ADDRESS>
</BODY>
</HTML>
